import Vue from "vue"
import VueX from "vuex"

Vue.use(VueX)

const store = new VueX.Store({
    state:{
        user:{
            identity:"",
            id:"",
            name:"",
            token:"",
        }
    },
    mutations:{
        login(state,playload){
            state.user.id = playload.id
            state.user.identity = playload.identity
            state.user.name = playload.name
            state.user.token = playload.token
            sessionStorage.setItem("token",playload.token)
            sessionStorage.setItem("identity",playload.identity)
        }
    },
    actions:{},
    getters:{},
})

export default store